<% content_for :javascript do %>
<%= javascript_include_tag 'dcmgr_gui/volume_panel.js' %>
<%= javascript_include_tag 'ui.selectmenu.js' %>
<script type="text/javascript">
  jQuery(function($){
  dcmgrGUI.volumePanel();
  });
</script>
<% end %>

<% content_for :stylesheet do %>
<style type="text/css">
  .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { text-align:center; float: none;}
  .ui-dialog .ui-dialog-content {margin:5px;}
  .ui-selectmenu-status { margin-top: 1px; }
</style>
<% end %>

<div id="mainarea_wide">
  <h3><img src="images/icon_resource.gif" /><%= t("volumes.header") %><a href="javascript:void(0);" class="showhide"></a></h3>
  <div id="list_load_mask" class="maincontent">
    <div class="controller clearfix">
      <a href="javascript:void(0);" class="create_volume"><%= t("volumes.button.create_volume") %></a>
      <a href="javascript:void(0);" class="delete_volume"><%= t("volumes.button.delete_volume") %></a>
      <a href="javascript:void(0);" class="create_backup"><%= t("volumes.button.create_backup") %></a>
      <select name="volume_action" id="volume_action" style="height:10px">
        <option value="" selected="selected"><%= t("selectmenu.select_action") %></option>
        <optgroup label="Action">
  	  <option class="attach_volume" value="attach_volume"><%= t("volumes.volume_actions.attach_volume") %></option>
  	  <option class="detach_volume" value="detach_volume"><%= t("volumes.volume_actions.detach_volume") %></option>
  	</optgroup>
      </select>
      <a href="javascript:void(0);" class="refresh" style="margin-left:585px"><%= t("button.refresh") %></a>
    </div>
    
    <div class="controller clearfix">
      <div id="pagenate" class="r_float">
	<a href="javascript:void(0);" class="prev"></a>
	<p id="viewPagenate"></p>
	<a href="javascript:void(0);" class="next"></a>
      </div>
    </div>
    <div id="display_volumes" class="display_area">
      <% content_for :javascript_template do %>
      <script id="volumesListTemplate" type="text/x-jquery-tmpl">
	<table class="ptn01" frame="void" cellpadding="0" cellspacing="0" border="0">
	  <tr> 
	    <th></th>
	    <th><%= t("volumes.list.display_name") %></th>
	    <th><%= t("volumes.list.capacity") %></th>
	    <th><%= t("volumes.list.backup_object_id") %></th>
	    <th><%= t("volumes.list.created") %></th>
	    <th><%= t("volumes.list.status") %></th>
	    <th><%= t("volumes.list.action") %></th>
	  </tr>
	  {{each(index,item) rows}}
	  <tr id="row-${item.uuid}">
	    {{if item.uuid }}
	    <td class="listcheckbox"><input type="checkbox" value="${item.uuid}" > </td>
	    {{else}}
	    <td class="listcheckbox"></td>
	    {{/if}}
	    <td class="vtip display_name" title="display name">${item.display_name}</td>
	    <td class="vtip center volume_size" title="size" style="width:40px">${displayDiskSize(this.size, 'MB')}</td>
	    <td class="vtip center" title="backup object id">${item.backup_object_id}</td>
	    <td class="vtip" title="created">${item.created_at}</td>
	    <td class="state vtip center" title="status">${item.state}</td>
	    {{if item.uuid }}
	    <td class="vtip center" title="action">
	      {{if item.state != "deleted" }}
	      <a href="javascript:void(0);" class="edit_volume" id="edit_${item.uuid}"><%= t('volumes.button.edit_volume') %></a>
	      {{else}}
	      <a href="javascript:void(0);" class="edit_volume"><%= t('volumes.button.edit_volume') %></a>
	      {{/if}}
	    </td>
	    {{else}}
	    <td class="vtip center" title="action"></td>
	    {{/if}}
	  </tr>
	  {{/each}}
	</table>
      </script>
      <% end %>
    </div>
  </div>
  <div id="btm_maincontent_wide"></div>
  <h3><img src="images/icon_ttl_detail.gif" /><%= t("volumes.details.header") %><a href="javascript:void(0);" class="showhide"></a></h3>
  <div id="detail" class="maincontent">
    <% content_for :javascript_template do %>
    <script id="volumesDetailTemplate" type="text/x-jquery-tmpl">
      <div id="${item.uuid}" class="display_area">
	<h4 class="ptn01"><%= t("volumes.details.volume_id") %>:<span class="instansid">${item.uuid}</span></h4>
	<table class="ptn02" frame="void" cellpadding="0" cellspacing="0" border="0">
	  <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("volumes.details.volume_id") %>:</td>
	    <td class="volume_size">${item.uuid}</td>
	    <td class="padcell"></td>
	    <td class="title"><%= t("volumes.details.display_name") %>:</td>
	    <td>${item.display_name}</td>
          </tr>
          <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("volumes.details.capacity") %>:</td>
	    <td>${displayDiskSize(this.size, 'MB')}</td>
	    <td class="padcell"></td>
	    <td class="title"><%= t("volumes.details.backup_object_id") %>:</td>
	    <td>${item.backup_object_id}</td>
          <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("volumes.details.status") %>:</td>
	    <td class="state">${item.state}</td>
	  </tr>
	  <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("volumes.details.created_at") %>:</td>
	    <td colspan="7">${item.created_at}</td>
	  </tr>
	</table>
      </div>
    </script>
    <% end %>
  </div><!-- maincontent -->
  <div id="btm_maincontent_wide_last"></div>
</div><!-- mainarea_wide -->
